package com.esionwong.basic.service;

import com.esionwong.basic.entity.SysUser;
import com.esionwong.basic.framework.common.service.BaseService;
import com.esionwong.basic.framework.core.pagination.Paging;
import com.esionwong.basic.param.sysUser.ResetPasswordParam;
import com.esionwong.basic.param.sysUser.SysUserPageParam;
import com.esionwong.basic.param.sysUser.UpdatePasswordParam;
import com.esionwong.basic.vo.SysUserQueryVo;

import java.io.Serializable;

/**
 * 系统用户 服务类
 *
 * @author esionwong
 */
public interface SysUserService extends BaseService<SysUser> {

    /**
     * 保存
     *
     * @param sysUser 用户信息
     * @return boolean
     * @throws Exception
     */
    boolean saveSysUser(SysUser sysUser) throws Exception;

    /**
     * 修改
     *
     * @param sysUser 用户信息
     * @return boolean
     * @throws Exception
     */
    boolean updateSysUser(SysUser sysUser) throws Exception;

    /**
     * 删除
     *
     * @param id 用户ID
     * @return boolean
     * @throws Exception
     */
    boolean deleteSysUser(Long id) throws Exception;

    /**
     * 根据ID获取查询对象
     *
     * @param id 用户ID
     * @return 用户信息
     * @throws Exception
     */
    SysUserQueryVo getSysUserById(Serializable id) throws Exception;

    /**
     * 获取分页对象
     *
     * @param sysUserPageParam 用户分页传参
     * @return 用户信息
     * @throws Exception
     */
    Paging<SysUserQueryVo> getSysUserPageList(SysUserPageParam sysUserPageParam) throws Exception;

    /**
     * 判断用户名是否存在
     *
     * @param username 用户名
     * @return boolean
     * @throws Exception
     */
    boolean isExistsByUsername(String username) throws Exception;

    /**
     * 检验部门和角色是否存在并且已启用
     *
     * @param departmentId 部门ID
     * @param roleId 角色ID
     * @throws Exception
     */
    void checkDepartmentAndRole(Long departmentId, Long roleId) throws Exception;

    /**
     * 通过角色id判断是否存在可用用户id
     *
     * @param roleId 角色ID
     * @return boolean
     * @throws Exception
     */
    boolean isExistsSysUserByRoleId(Long roleId) throws Exception;

    /**
     * 修改密码
     *
     * @param updatePasswordParam 更新密码的传参
     * @return boolean
     * @throws Exception
     */
    boolean updatePassword(UpdatePasswordParam updatePasswordParam) throws Exception;

    /**
     * 修改系统用户头像
     *
     * @param id 用户ID
     * @param headPath 路径
     * @return boolean
     * @throws Exception
     */
    boolean updateSysUserHead(Long id, String headPath) throws Exception;

    /**
     * 管理员重置用户密码
     *
     * @param resetPasswordParam 重置密码的传参
     * @return boolean
     * @throws Exception
     */
    boolean resetPassword(ResetPasswordParam resetPasswordParam) throws Exception;
}
